package org.nci.uRunking.dao.imp;

import java.util.List;

import javax.annotation.Resource;

import org.hibernate.SessionFactory;
import org.nci.uRunking.dao.IUserDAO;
import org.nci.uRunking.model.User;
import org.springframework.stereotype.Repository;

@Repository("userDAO")
public class UserDAO implements IUserDAO {
	@Resource(name="sessionFactory")
	private SessionFactory sessionFactory;

	public void setSessionFactory(SessionFactory sessionFactory) {
		this.sessionFactory = sessionFactory;
	}

	public List<User> query() {
		List<User> list = this.sessionFactory.getCurrentSession().createQuery(" from User").list();
		for (User user : list) {
			System.out.println(user.getName());
		}
		return list;
	}
	
	
}
